<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
    <meta charset="utf-8" />
    <title><?php echo (L("Qibei")); ?></title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />

    <!-- ================== BEGIN BASE CSS STYLE ================== -->
    <link href="./Public/Admin/assets/plugins/jquery-ui/themes/base/minified/jquery-ui.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/animate.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/style.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/style-responsive.min.css" rel="stylesheet" />
    <link href="./Public/Admin/assets/css/theme/default.css" rel="stylesheet" id="theme" />
    <!-- ================== END BASE CSS STYLE ================== -->

    <!-- ================== BEGIN PAGE LEVEL STYLE ================== -->
    <link href="./Public/Admin/assets/plugins/DataTables/css/data-table.css" rel="stylesheet" />
    <!-- ================== END PAGE LEVEL STYLE ================== -->

    <!-- ================== BEGIN BASE JS ================== -->
    <script src="./Public/Admin/assets/plugins/pace/pace.min.js"></script>
    <!-- ================== END BASE JS ================== -->
</head>
<body>
<?php include './Public/Admin/header.html'; ?>



<!-- begin #content -->
<div id="content" class="content">
    <!-- begin breadcrumb -->
    <ol class="breadcrumb pull-right">
        <li><a href="javascript:;"><?php echo (L("index")); ?></a></li>
        <li><a href="javascript:;"><?php echo (L("mInformation")); ?></a></li>
        <li class="active"><?php echo (L("mModify")); ?></li>

    </ol>
    <!-- end breadcrumb -->
    <!-- begin page-header -->
    <h1 class="page-header"><?php echo (L("mInformation")); ?> <small><?php echo (L("mModify")); ?></small></h1>
    <!-- end page-header -->

    <!-- begin row -->
    <div class="row">
        <!-- begin col-12 -->
        <div class="col-md-12">
            <!-- begin panel -->
            <div class="panel panel-inverse">
                <div class="panel-heading">
                    <div class="panel-heading-btn">
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
                    </div>
                    <h4 class="panel-title"><?php echo (L("mModification")); ?></h4>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <!--表单-->

                        <div class='col-md-10'>
                            <form class='form-horizontal' role='form'  method="post" action="index.php?m=Admin&c=Merchant&a=lists&type=2&id=<?php echo ($shopid); ?>" enctype="multipart/form-data">
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mType")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="lid" id='lid'  value=""  disabled>
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mName")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="name" id='name'  value="" disabled>
                                    </div>
                                </div>

                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mTel")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="phone" id="phone" value="" disabled>
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mInstruction")); ?>：</label>
                                    <div class='col-md-4'>
                                        <textarea class="form-control" rows='3' name="cn_abstract" id="cn_abstract"  placeholder="<?php echo (L("mInstruction")); ?>"></textarea>
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mAddress")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg'  name="addr" id="addr"  disabled>
                                    </div>
                                </div>

                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mService")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="standards" id='standards'  value="">
                                    </div>
                                </div>

                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mLife")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="life_description" id='life_description'  value="">
                                    </div>
                                </div>
                                <div class='form-group' >
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mSpecial")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="characteristic" id='characteristic'  value="">
                                    </div>
                                </div>
                                <div class='form-group'  >
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mFree")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="gift" id='gift'  value="">
                                    </div>
                                </div>

                                <div class='form-group'  >
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mNotIncluded")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="not_contain" id='not_contain'  value="">
                                    </div>
                                </div>

                                <div class='form-group' >
                                    <label for='inputtext' class='col-md-2 control-label' id="test"><?php echo (L("mLogo")); ?></label>
                                </div>


                                <div class='form-group' id="addInput">
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mPhoto")); ?></label>
                                    <div class='col-md-4'>
                                        &nbsp;&nbsp;&nbsp;&nbsp;<a id="but" class="btn btn-primary"><?php echo (L("plus")); ?></a>
                                    </div>

                                </div>
                                <div class='form-group' id="addImg">
                                    <label for='inputtext' class='col-md-2 control-label'></label>

                                </div>



                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mCreate")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="create_time" id='create_time'  value=""  disabled>
                                    </div>
                                </div>

                                <div class='form-group'>
                                    <label for='inputtext' class='col-md-2 control-label'><?php echo (L("mModification")); ?>：</label>
                                    <div class='col-md-4'>
                                        <input type='text' class='form-control input-lg' name="update_time" id='update_time'  value=""  disabled>
                                    </div>
                                </div>


                                <div class='form-group'>
                                    <div class='col-md-3 col-md-offset-2'>
                                        <button  class='btn btn-success btn-radius'><?php echo (L("submit")); ?></button>
                                    </div>
                                </div>
                            </form>
                        </div>

                    </div>
                </div>
            </div>
            <!-- end panel -->
        </div>
        <!-- end col-12 -->
    </div>
    <!-- end row -->
</div>
<!-- end #content -->


<!-- begin scroll to top btn -->
<a href="javascript:;" class="btn btn-icon btn-circle btn-success btn-scroll-to-top fade" data-click="scroll-top"><i class="fa fa-angle-up"></i></a>
<!-- end scroll to top btn -->
<?php include './header.html'; ?>
<!-- end page container -->

<!-- ================== BEGIN BASE JS ================== -->
<script src="./Public/Admin/assets/plugins/jquery/jquery-1.9.1.min.js"></script>
<script src="./Public/Admin/assets/plugins/jquery/jquery-migrate-1.1.0.min.js"></script>
<script src="./Public/Admin/assets/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
<script src="./Public/Admin/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="./Public/Admin/assets/crossbrowserjs/html5shiv.js"></script>
<script src="./Public/Admin/assets/crossbrowserjs/respond.min.js"></script>
<script src="./Public/Admin/assets/crossbrowserjs/excanvas.min.js"></script>
<![endif]-->
<script src="./Public/Admin/assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- ================== END BASE JS ================== -->

<!-- ================== BEGIN PAGE LEVEL JS ================== -->
<script src="./Public/Admin/assets/plugins/DataTables/js/jquery.dataTables.js"></script>
<script src="./Public/Admin/assets/plugins/DataTables/js/dataTables.colVis.js"></script>
<script src="./Public/Admin/assets/js/apps.min.js"></script>
<!-- ================== END PAGE LEVEL JS ================== -->
<script>
    $(document).ready(function() {
        App.init();

        loadc();
    });


    var dataNum=-1;
    function loadc(){
        $.getJSON("index.php?m=Admin&c=Merchant&a=update_list&type=1",function(result){
            if(result!=0){
                $('#lid').val(result.lid);
                $('#name').val(result.name);
                $("#phone").val(result.phone);
                $("#cn_abstract").val(result.cn_abstract);
                $("#addr").val(result.addr);
                $("#standards").val(result.standards);
                $("#life_description").val(result.life_description);
                $("#characteristic").val(result.characteristic);
                $("#gift").val(result.gift);
                $("#not_contain").val(result.not_contain);
                $("#create_time").val(result.create_time);
                $("#update_time").val(result.update_time);

               var  html=" ";
                    html+= '<div id="logo_img" class="col-xs-6 col-md-2"><a href="#" class="thumbnail"><img src="./imageShopLog/' +result.logo_img + '"></a>';
                    html+='<div class="col-md-5">&nbsp;&nbsp;<div class="col-md-8"><a class="btn btn-success" id="updateLogo" onclick="update()" ><?php echo (L("delete")); ?></a></div>'
            }
            $("#test").after(html);

        });
//======================================获取并处理形象图==============================================
     $.getJSON("index.php?m=Admin&c=Merchant&a=get_imgs_list",function(result){
           if(result!=0){
              var getNum=result.length-1;
                  dataNum=getNum;
               for(var i=0; i<=getNum; i++){
                var showHtml= '<div  class="form-group" id="imgs'+i+'">';
                    showHtml+="<label for='inputtext' class='col-md-2 control-label'></label>";
                    showHtml+= '<div class="col-xs-6 col-md-2"><a href="#" class="thumbnail"><img src="./imageShop/'+result[i] +'"></a>';
                    showHtml+='<div class="col-md-5">&nbsp;&nbsp;<div class="col-md-8"><a class="btn btn-success" id="del'+i+'" onclick="del('+i+')" ><?php echo (L("delete")); ?></a></div></div></div>';
                    $("#addImg").after(showHtml);
               }

           }

       });

        $("#but").click(function(){
              if(dataNum<4){
                   dataNum++;
                  var newRow='<div  class="col-md-4 col-md-offset-2"><input type="file" name="imgs[]" id="inputImage'+dataNum+'"/></div>';
                    newRow+='<div class="col-md-2"><a class="btn btn-success" id="inputDel'+dataNum+'" onclick="inputDel('+dataNum+')" ><?php echo (L("delete")); ?></a></div>';
                $("#addInput").after(newRow);
            }
        });




    }
    //===========================================修改商铺Logo图===============================================

    function update(){

                var logoHtml="<div  class='col-md-4' id='logo_img'>";
                    logoHtml+= '<input type="file" name="logo_img" id="logo_img"/>';
                    logoHtml += "</div>";
                  $("#logo_img").html(logoHtml);

        //要考虑删除图片的逻辑
    }

    //========================删除修改显示的图片===========================
    function del(obj){
        $.getJSON("index.php?m=Admin&c=Merchant&a=update_imgs&imgNum="+obj,function(result){
            dataNum--;
            if(result!=0){
                $("#imgs"+obj).remove();
            }

        });
    }
//=========================================删除还没有提交的input表单=================================================================
            function inputDel(obj){
                dataNum--;
                $("#inputImage"+obj).remove();
                $("#inputDel"+obj).remove();
            }




</script>
</body>
</html>